/*
** my.h for my_select in /home/nadali_t//local/svn/tek2ed/my_select
** 
** Made by thomas nadalie
** Login   <nadali_t@epitech.net>
** 
** Started on  Mon Nov 19 16:08:53 2012 thomas nadalie
** Last update Sun Nov 25 18:19:00 2012 thomas nadalie
*/

#ifndef		__MY_H__
#define		__MY_H__

typedef struct	s_list
{
  char		*arg;
  int		x;
  int		y;
  struct s_list	*prev;
  struct s_list	*next;
}		t_list;

/* LIB */

#include        <unistd.h>
#include	<termios.h>
#include	<strings.h>
#include	<stdarg.h>

# define        DECI    "0123456789"
# define        OCTAL   "01234567"
# define        HEXA    "0123456789ABCDEF"
# define        BIN     "01"
# define	DOWN	4348699
# define	UP	4283163
# define	CTRLC	3
# define	CTRLD	4

void		my_put_error(char *str);
void		my_put_nbr(int nb);
void		my_swap(int *a, int *b);
void		my_putstr(const char *str);
void		my_sort_int_tab(int *tab, int size);
void            my_bzero(char *b, size_t size);
void		my_showlist(t_list *list);

int		my_putchar(int c);
int		my_isneg(int nb);
int		my_strlen(const char *str);
int		my_getnbr(char *str);
int		my_power_rec(int nb, int power);
int		my_square_root(int nb);
int		my_is_prime(int nombre);
int		my_find_prime_sup(int nb);
int		my_strcmp(char *s1, char *s2);
int		my_strncmp(char *s1, char *s2, int nb);
int		my_str_isalpha(char *str);
int		my_str_isnum(char *str);
int		my_str_islower(char *str);
int		my_str_isupper(char *str);
int		my_str_isprintable(char *str);
int		my_showstr(char *str);
int		my_showmem(char *str, int size);
int		my_strlcat(char *dest, char *src, int size);

char		*my_strcpy(char *dest, char *src);
char		*my_strncpy(char *dest, char *src, int nb);
char		*my_revstr(char *str);
char		*my_strstr(char *str, char *to_find);
char		*my_strupcase(char *str);
char		*my_strlowcase(char *str);
char		*my_strcapitalize(char *str);
char		*my_strcat(char *dest, char *src);
char		*my_strncat(char *dest, char *src, int nb);
char            *my_strdup(const char *src);

int             check_flag(char format, va_list ap);
int             catch_opt(const char *format, va_list ap);
char            *convert_func(int nb, char *base, int i, int count2);
char            *convert_base(char *nbr, char *base_from, char *base_to);
void            init_functab(void (**functab)(va_list));
void            init_flagtab(char *tab);
int             my_printf(const char *format, ...);
void            opt_xx();
void            opt_b(va_list ap);
void            opt_d(va_list ap);
void            opt_i(va_list ap);
void            opt_o(va_list ap);
void            opt_u(va_list ap);
void            opt_x();
void            opt_s(va_list ap);
void            opt_c(va_list ap);
void            opt_percent();

t_list		*my_put_in_list(t_list **list, char *arg);

/* MY_SELECT */

t_list		*create_list();
int		my_select(int ac, char **av);
int		catch_key(t_list *list);
void            raw_mode(struct termios *t);
void            react_echo(struct termios *t);
t_list		*down_arrow(t_list *list);
t_list		*up_arrow(t_list *list);
void		init_keytab(int *itab);
void		init_functiontab(t_list *(**functab)(t_list *list));
t_list		*ctrl_c(t_list *list);
t_list		*ctrl_d(t_list *list);
void		make_read(t_list *(**functab)(t_list *list),
			  int *itab, t_list *list);
void		clear_s();

#endif
